﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<script type="text/javascript" src="../../Scripts/jquerytools/swfobject.js"></script>
<script type="text/javascript" src="../../Scripts/jquerytools/jquery.uploadify.v2.1.0.min.js"></script>
<link href="../../Scripts/jquerytools/styles/uploadify.css" rel="stylesheet" type="text/css" />


<div>    
<input id="<%=ViewData["uploadFileId"]%>" name="uploadify" type="file"/>
<%--<input type="button" value="确定" onclick="javascript:$('#<%=ViewData["uploadFileId"]%>').uploadifyUpload();" />--%>
<input type="hidden" name ="loadJsFlag" value="0" />
</div> 

<script type="text/javascript" language="javascript">
    if ($("input[name='loadJsFlag']").eq(0).val() == "0") {
        $(function () {    //上传    
            $("input[name='uploadify']").uploadify({
                'uploader': '/Scripts/jquerytools/other/uploadify.swf',
                'script': '/Common/Import',
                'folder': '/Upload',
                'cancelImg': '/Scripts/jquerytools/other/cancel.png',
                'fileExt': '*.*',
                'fileDesc': '*.*',
                'sizeLimit': 1024 * 1024 * 100, //100M        
                'multi': true,
                'auto': true,
                'onComplete': function (event, queueID, fileObj, response, data) {
                    $(".cancel").hide();
                    var filepath = $("#" + event.currentTarget.id).attr("filepath");
                    if (!filepath) {
                        $("#" + event.currentTarget.id).attr("filepath", response);
                    } else {
                        $("#" + event.currentTarget.id).attr("filepath", filepath + "," + response);
                    }

                    if (response != "") {
                        showInfo("成功上传" + response, true); //showInfo方法设置上传结果    
                    }
                    else { showInfo("文件上传出错！", false); }
                }
            });
        });
        $("input[name='loadJsFlag']").eq(0).val("1");
    }
 </script>